Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to replace dashes with underscore in the metric names #1103

Merged
merged 2 commits into from
Dec 22, 2024

Conversation

aagarwalla-fx
Copy link
Contributor

This fix is to cater to the Issue - #1102, where the exporter is crashing with the following signature.

panic: "pg_settings_mem_guard_enable-auth-hook" is not a valid metric name

goroutine 52 [running]:
github.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)
	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/value.go:129
main.(*pgSetting).metric(0xc00020c640, 0xc00020a2a0)
	/app/cmd/postgres_exporter/pg_setting.go:99 +0x2ff
main.querySettings(0xc00022e070, 0xc00025a000)
	/app/cmd/postgres_exporter/pg_setting.go:55 +0x1d8
main.(*Server).Scrape(0xc00025a000, 0xc00022e070, 0x0?)
	/app/cmd/postgres_exporter/server.go:120 +0xc8
main.(*Exporter).scrapeDSN(0xc000174000, 0xc00022e070, {0xc0000be140, 0x92})
	/app/cmd/postgres_exporter/datasource.go:114 +0x132
main.(*Exporter).scrape(0xc000174000, 0xc00022e070)
	/app/cmd/postgres_exporter/postgres_exporter.go:678 +0x16b
main.(*Exporter).Collect(0xc000174000, 0xc00022e070)
	/app/cmd/postgres_exporter/postgres_exporter.go:567 +0x25
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:458 +0xe5
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather in goroutine 39
	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:548 +0xbab

@sysadmind sysadmind merged commit 5bb1702 into prometheus-community:master Dec 22, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants